var baseUrl = 'http://192.168.191.10:8090/',
    baseUrls = 'http://172.20.10.9:7999/',
    uploadUrl = 'http://192.168.0.118:8001/',
    address = 'E:/xzptFile/',
    faceImgAddress = 'E/face/',
// var baseUrl = 'http://10.161.82.49:8000/',
//     baseUrls = 'http://10.161.82.49:7999/',
//     uploadUrl = 'http://10.161.82.49:8001/',
//     address = 'xzptFile/clue/',
//     faceImgAddress = 'xzptFile/face/',
    hrefAdress = '',
    setFont = 'bold 14px Arial',//画图工具字体设置
//指令上传路径X
    addresses = 'xzptFile/order/',
    fileSize = 2147483648, //2G
//指令附件大小限制
    fileSizes = 209715200, //200M
    data = {
        fx: ['短发','长发','卷发','光头','平头','秃头','辫子','披肩','其他'],
        yzys: ['红','黄','绿','蓝'],
        lx: ['圆脸型','椭圆脸型','长方脸型','正方脸型','三角脸型'],
        tx: ['特胖','较胖','中等','较瘦','特瘦'],
        cpys: ['红','蓝','黄','绿','白','灰','黑'],
        sftp: ['是','否'],
        cltz: ['撞损','车贴','挂饰','天窗'],
        zagj: [
            {
                tool: '枪弹',
                key: '16000110000'
            },
            {
                tool: '通讯工具',
                key: '16000170000'
            },
            {
                tool: '金融工具',
                key: '16000180000'
            },
            {
                tool: '证书',
                key: '16000320000'
            },
            {
                tool: '文书',
                key: '16000490000'
            },
            {
                tool: '麻醉品',
                key: '16000540000'
            },
            {
                tool: '刀具',
                key: '16000100101'
            },
            {
                tool: '锤具',
                key: '16000100109'
            },
            {
                tool: '开锁工具',
                key: '16000100115'
            },
            {
                tool: '绳索',
                key: '16000100900'
            },
            {
                tool: '棍棒',
                key: '16000101000'
            },
        ],
        cllx: ['轿车','客车','货车','专用车','摩托车','三轮车','非机动车'],
        clxh: ['大众','宝马','奔驰','别克','本田','日产','哈弗','长城','其他']
    }
var index = '';
//数据加载中

Date.prototype.format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
Date.prototype.bzsj = function() {
    return this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + this.getDate() + " " + this.getHours() + ":" + this.getMinutes() + ":" + this.getSeconds();
};
var day1 = new Date();
day1.setDate(day1.getDate());
var s1 = day1.format("yyyy-MM-dd 23:59:59"),
    s2 = day1.format("yyyy-MM-dd hh:mm:ss");

function Loading(){
    $('.mark').show();
    index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
}
//关闭弹出框
function closeLoading() {
    $('.mark').hide();
    layer.close(index);
}
//提示信息
function Msg(item,num){
    if(item){
        if(num){
            layer.msg(item,{time: 2000, icon:num});
        }else{
            layer.msg(item,{time: 2000, icon:5});
        }
    }else{
        layer.msg('服务器繁忙，请稍后再试或联系管理员。',{time: 2000, icon:5});
    }
}
//图片丢失
function nofind(item){
    item.src = 'common/img/nothing.png';
    item.onerror = null;
}
function nulls(item){
    var callback,
        item = $.trim(item);
    if(item != null && item != undefined && item.indexOf('null') < 0){
        callback = item;
    } else {
        callback = '无';
    }
    return callback;
}
function sendAjax(type,interFace,data,parame,url){ //前两个必传 后三个选传
    var parames = parame ? JSON.parse(parame): {},
        datas = null;
    if(data){
        if(data instanceof Object){
            datas = data;
        }else{
            if(parames.dataType == null){
                datas = JSON.parse(data);
            }else{
                datas = data;
            }
        }
    }
    parames.type = type;
    parames.cache = false;
    parames.data = datas;
    parames.url = url ? url + interFace : baseUrl + interFace;
    parames.beforeSend = function(){
        Loading();
    };
    parames.success = function (response){
        closeLoading();
        return response;
    };
    parames.onerror = function(err){
        closeLoading();
        Msg();
    }
    $.ajax(
        parames
    )
}
//tip
function tips(val,index){
    layer.tips(val, '#' + index,{ tips: [1, '#2180d4'],time:2000});

}
//指令详情
function orderDetail(comid){
    layer.open({
        title:'指令详情',
        type: 2,
        area: ['80%', '80%'],
        fixed: false, //不固定
        maxmin: false,
        content: 'layer/orderDetail.html?comid=' + comid
    });
}